package com.jfinal.bbsapp.video;
import com.jfinal.aop.Inject;
import com.jfinal.bbsapp.common.kit.CommonUtils;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
@Path("/v")
public class VideoController extends Controller {
	
	@Inject
	VideoService srv;
	
	//当前章节是否收藏过
	public void iscollect(){
		renderJson(srv.iscollect(getRequest().getHeader("token"),getPara("chapterid")));
	}
	
	//收藏添加
	public void collectadd(){
		renderJson(srv.collectadd(getRequest().getHeader("token"),getPara("chapterid")));
	}
	
	//收藏删除
	public void collectdel(){
		renderJson(srv.collectdel(getRequest().getHeader("token"),getPara("chapterid")));
	}
	
	//我的课程收藏分页列表
	public void collectplist() {
		int pagecurrent = CommonUtils.getPageNum(getPara("pagecurrent")), pagesize = CommonUtils.getPageSize(getPara("pagesize"));
		renderJson(srv.collectplist(getRequest().getHeader("token"),pagecurrent,pagesize));
	}
	
	//课程卡核销
	public void issure(){
		renderJson(srv.issure(getRequest().getHeader("token"),getPara("courseid"),getPara("cardno")));
	}
	
	//校验课程是否已开卡与是否要人脸核身
	public void coursecheck(){
		renderJson(srv.coursecheck(getRequest().getHeader("token"),getPara("courseid")));
	}
	
	//添加观看记录
	public void recordadd(){
		renderJson(srv.recordadd(getRequest().getHeader("token"),getPara("chapterid"),getPara("watchtime")));
	}
	
	//观看记录提交长度
	public void recordstartnum(){
		renderJson(srv.recordstartnum(getRequest().getHeader("token")));
	}

}

